var layerId;
$(function(){
	$("#addTopic-button").click(function(){
		layerId=layer.open({
			title: "新增商品类型",
			area: ['1200px','700px'],
			fix:true,
			type: 2,
			content: basePath+'/goodsType/add.shtml'
		});
	})
	$(".show-span").click(function(){
		var id = $(this).parent().parent().attr("data-id");
		var type= $(this).attr("type");
		if(type=="show"){
			$(".type-"+id).show();
			$(this).attr("type","hide");
			$(this).html("<i class=\"layui-icon\">&#xe619;</i>");
		}else{
			$(".type-"+id).hide();
			$(this).attr("type","show");
			$(this).html("<i class=\"layui-icon\">&#xe61a;</i>");
		}
		
	})
})
function editFun(typeId){
	layerId=layer.open({
		title: "修改商品类型",
		area: ['1200px','700px'],
		fix:true,
		type: 2,
		content: basePath+'/goodsType/edit.shtml?typeId='+typeId
	});
}
function deleteFun(typeId){
	if(confirm("确认删除？")){
		 $.ajax({
	  		 url:basePath+"/goodsType/delete.shtml?typeId="+typeId,  
	  		 type:"post",
	  		 dataType:"JSON",
	  		 success:ajaxSuccessRefreshFun
	  	 });
	}
}
function updateStatus(typeId){
	$.ajax({
		url:basePath+"/goodsType/updateState.shtml?typeId="+typeId,  
		type:"post",
		dataType:"JSON",
		success:ajaxSuccessRefreshFun
	});
	
}
